<script type="text/javascript">
<!--
function requestPagePermissions(page_id)
{
    $('#loaderMini'+page_id).css('display','inline-block');
    $('#page'+page_id).addClass('selected');
    $('#page'+page_id).blur();

    $.post('<?php echo url_for('@install_step1_update') ?>', {
        wall_post_enabled: ($('#wall_post_enabled').is(':checked') ? '1' : '0')
    }, function (data) {
        addToPage(page_id);
    });
}

function finishInstall(page_id)
{
    $('#loaderMini'+page_id).css('display','inline-block');
    $.post('<?php echo url_for('@install_step1_update') ?>', {
        wall_post_enabled: ($('#wall_post_enabled').is(':checked') ? '1' : '0')
    }, function (data) {
        top.location.href = '<?php echo url_for('@install_step1_save', true) ?>?page_id='+page_id;
    });
}

function addToPage(page_id)
{
    top.location.href = '<?php echo ($sf_request->isSecure() ? 'https' : 'http') ?>://facebook.com/add.php?api_key=<?php echo sfConfig::get('sf_facebook_app_id') ?>&pages&perms=publish_stream&page='+page_id;
}

function trackNewPage() {
    $.post('<?php echo url_for('@redirect_count?counter=step1_new_page', true) ?>');
    _gaq.push(['_trackEvent','install','step1_new_page','GET_params','<?php echo $tracking_params ?>']);
    _gaq.push(['_trackPageview','/install/step1_new_page?<?php echo $tracking_params ?>']);
    $('#refresh_button').show();
}

function loadPages() {
    $('#step1_pages').load('<?php echo url_for('@install_step1_pages') ?>', {access_token:'<?php echo $access_token?>'});
}

$(document).ready(function () {
    loadPages();
});
-->
</script>
